<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 在函数前面加async
        async function data(){
            console.log('我先执行');
            // await只能等promise实例,其他的一概不等
            await new Promise((resolve,reject)=>{
                setTimeout(()=>{
                    console.log('我是定时器');
                    resolve('123')
                },3000)
             
            })
            console.log('还要我等你');
        }
        data();
        console.log('end');
    </script>
</body>
</html>